//
//  DBJTextField.m
//  DBJ
//
//  Created by 花化华 on 2016/11/16.
//  Copyright © 2016年 itcast. All rights reserved.
//

#import "DBJTextField.h"

@implementation DBJTextField

- (instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        [self dbjSetupSubviews];
    }
    return self;
}

- (instancetype)initWithCoder:(NSCoder *)aDecoder{
    if (self = [super initWithCoder:aDecoder]) {
        [self dbjSetupSubviews];
    }
    return self;
}

- (void)dbjSetupSubviews{
    //监听键盘的弹出事件
    //1.创建一个NSNotificationCenter对象
    NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
    
    //2.监听键盘的弹出通知
    [notificationCenter addObserver:self selector:@selector(keybordWillChange:) name:UIKeyboardWillChangeFrameNotification object:nil];
}

#pragma mark - 键盘伸缩
- (void)keybordWillChange:(NSNotification *)noteInfo{
    [DBJTools keybordWillChange:noteInfo andView:_view];
}

@end
